home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-09-29 | 1.3 KB | 66 lines | [TEXT/KAHL] |
-
- #include <Types.h>
- #include <Resources.h>
- #include <QuickDraw.h>
- #include <ToolUtils.h>
- #include <Sound.h>
-
- #include "soundchannel.h"
-
- soundchannel::soundchannel()
- {
- OSErr result;
-
- thechannel = 0L;
- result = SndNewChannel( &thechannel, squareWaveSynth, 0, 0L);
-
- if( result != noErr)
- {
- DebugStr( "\pSndNewChannel failed");
- }
- }
-
- soundchannel::~soundchannel()
- {
- (void)SndDisposeChannel( thechannel, true);
- }
-
- void soundchannel::playsound( const int resno) const
- {
- playsound( (SndListHandle)Get1Resource( 'snd ', resno));
- }
-
- void soundchannel::playsound( SndListHandle thesound) const
- {
- //
- // NB: we do not use our own sound channel here (it is linked
- // to the square wave synthesizer and cannot play all sounds)
- //
- SndPlay( 0L, thesound, false);
- }
-
- void soundchannel::setamplitude( unsigned char amp) const
- {
- sendcommand( ampCmd, amp, 0);
- }
-
- void soundchannel::sendcommand( short cmd, short param1, long param2) const
- {
- SndCommand thecommand;
- thecommand.cmd = cmd;
- thecommand.param1 = param1;
- thecommand.param2 = param2;
-
- (void)SndDoCommand( thechannel, &thecommand, false);
- }
-
- void soundchannel::sendImmediate( short cmd, short param1, long param2) const
- {
- SndCommand thecommand;
- thecommand.cmd = cmd;
- thecommand.param1 = param1;
- thecommand.param2 = param2;
-
- (void)SndDoImmediate( thechannel, &thecommand);
- }
-